import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Credits here.
 * 
 * @author Christian Pérez Zavalija
 * @version 25-Jun-2013
 */
public class Credits extends World
{
    

    /**
     * Constructor for objects of class Credits.
     * Load and add the image to the world credits. Create the dimension of the world and calls the method prepare ()
     */
    public Credits()
    {    
        // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
        super(800, 800, 1);
        ImgCredits imgCredits = new ImgCredits();
        addObject(imgCredits, getWidth()/2, getHeight()/2);
        
        prepare();
    }
    
    /**
     * Place the button in the world Credits.
     */
    private void prepare()
    {
        BtnBack btnback = new BtnBack();
        addObject(btnback, 20, 38);
    }
    
    /**
     *Condition so that pressing the back button to return to the canvas or using the 'b'.
     */
    public void act()
    {
        if(Greenfoot.mousePressed(BtnBack.class)||Greenfoot.isKeyDown("b"))
        {
            Greenfoot.setWorld(new Canvas());
        }
    }
}
